package com.hmall.common.config;

import feign.Logger;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Feign配置类
 */
@EnableFeignClients(basePackages = "com.hmall.common.client")
@Configuration
public class FeignConfig {

    //配置RequestInterceptor feign请求拦截器，添加请求头信息
    @Bean
    public RequestInterceptor requestInterceptor(){
        return (RequestTemplate requestTemplate) -> requestTemplate.header("authorization","2");
    }

    //设置日志级别
    @Bean
    public Logger.Level level() {
        return Logger.Level.BASIC;
    }
}
